package WaiBao;

import java.util.Arrays;

public class ChangZiYi {
    public static void main(String[] args) {
        String[] name = {"林城阳(班长)", "王艳兵(副班长)", "小李(学习委员)", "李二牛(体育委员)", "赵乃钢", "张路灯", "李子桥", "王淑珍", "张汉杰", "李金鑫", "张佳玉", "李毅成",
                "张子茹", "李浩宇", "李晓燕", "思南", "俊宁", "李丽祥", "张云杰", "李星珊", "张伟航", "李正坤", "李志红", "张明政", "李子恒", "张依婷", "李成义", "穆行",
                "李子红", "常子怡(团支书)"};//考生本人: 常子怡(团支书)
        int[] age = {20, 21, 19, 20, 21, 22, 21, 21, 19, 19, 18, 18, 18, 21, 20, 19, 19, 18, 18, 18, 19, 19, 20, 20, 20, 18, 20, 21, 20, 20};//最后一位考生年龄：20岁

        double[] chrome1 = {81, 84, 94, 85, 78, 69, 78, 89, 80, 91, 90, 87, 85, 74, 65, 78, 69, 99, 96, 88, 92, 91, 95, 88, 75, 74, 78, 74, 81, 96};
        double[] chrome2 = {87, 64, 78, 88, 88, 76, 84, 79, 91, 80, 80, 78, 86, 76, 65, 65, 70, 74, 76, 68, 92, 71, 95, 81, 75, 84, 79, 94, 95, 96};
        double[] chrome3 = {78, 90, 91, 85, 71, 69, 78, 89, 80, 69, 93, 87, 85, 75, 65, 68, 69, 69, 96, 93, 92, 81, 95, 95, 79, 84, 77, 71, 84, 96};


        double shui1;//代表每个学生的总分
        double shui2;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            shui1 = chrome1[i] +chrome2[i] +chrome3[i];
//            shui2 = ( shui1* 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" + shui1);
//            System.out.println(name[i] + "的平均分为:" +shui2);
//        }



        double star1 = 0, star2 = 0;
        double[] jiuzhang = new double[30];
//        for (int i = 0; i < 30; i++) {
//            star1 = chrome1[i] + chrome2[i] +chrome3[i];
//            star2 = (star1 * 1.0) / 3;
//            jiuzhang[i] = star2;
//        }
//
//        for (int i = 0; i <jiuzhang.length - 1; i++) {
//            for (int j = 0; j < jiuzhang.length - i - 1; j++) {
//                if (jiuzhang[j] < jiuzhang[j + 1]) {
//                    double tep = jiuzhang[j];
//                    jiuzhang[j] = jiuzhang[j + 1];
//                    jiuzhang[j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println(jiuzhang[i]);
//        }


        double out1 = 0,out2 = 0, out3 = 0;//计算每门课的平均分
        double side1 = 0,side2 = 0, side3 = 0;//计算每门课标准差
        double every1 = 0, every2 = 0, every3 = 0;//计算每门课中位数
        double sum2 = 0;
        for (int i = 0; i <chrome1.length; i++) {
            sum2+=chrome1[i];
        }
        out1 = (sum2*1.0)/30;
        System.out.println("生物化学的班级平均分为:"+out1);
        double Sum = 0;
        for (int i = 0; i < chrome2.length; i++) {
            Sum+=chrome2[i];
        }
        out2 = (Sum*1.0)/30;
        System.out.println("微生物学的班级平均分为:"+out2);
        double sum = 0;
        for (int i = 0; i <chrome3.length; i++) {
            sum+=chrome3[i];
        }
        out3 = (sum*1.0)/30;
        System.out.println("人体组织解剖学的班级平均分为:"+out3);



        double c1 = 0,c2 = 0,c3 = 0;
        for (int i = 0; i <chrome1.length; i++) {
            c1+= (chrome1[i] -out1)*(chrome1[i] - out1);
        }
        side1 = Math.sqrt(c1*1.0/30);
        System.out.println("生物化学的班级标准差为:"+side1);

        for (int i = 0; i < chrome2.length; i++) {
            c2+= (chrome2[i] - out2)*(chrome2[i] - out2);
        }
        side2 = Math.sqrt(c2*1.0/30);
        System.out.println("微生物学的班级标准差为:"+side2);

        for (int i = 0; i < chrome3.length; i++) {
            c3+= (chrome3[i] -out3)*(chrome3[i] - out3);
        }
        side3 = Math.sqrt(c3*1.0/30);
        System.out.println("人体组织解剖学的班级标准差为:"+side3);
//////
//////
//        Arrays.sort(chrome1);
//        Arrays.sort(chrome2);
//        Arrays.sort(chrome3);
//        every1 =( chrome1[14]+chrome1[15])*1.0/2;
//        every2 =( chrome2[14]+chrome2[15])*1.0/2;
//        every3 =( chrome3[14]+chrome3[15])*1.0/2;
//        System.out.println("生物化学的中位数为:"+every1);
//        System.out.println("微生物学的中位数为:"+every2);
//        System.out.println("人体组织解剖学的中位数为:"+every3);







    }
}
